import {useSelector} from "react-redux";
import ArticleItem from "./articleItem.jsx";
// import  Pagination from "./pagination.jsx";




export default function ArticleList() {
    const authorarticle = useSelector(state => state.profilearticle);
    const {count, articles, currentPage} = authorarticle
    if (!articles) {
        return <div className='article-preview'>加载中</div>
    }
    if (articles && articles.length === 0) {
        return <div className='article-preview'>这里没有文章</div>
    }
    return (
        <div>
            {
                articles.map(article => <ArticleItem article={article} key={article.slug}/>)
            }
        {/*    分页数据*/}
            <Pagination
                count={count}
                currentPage={currentPage}
                onPageClick={onPageClick}
                isShowPage={isShowPage}
            />
        </div>
    )
}